/*var total;
$(function () {
	$.ajax({
		url:  baseURL + 'sys/sysTotal/list',
	    dataType:"json",   //返回格式为json
	    async:true,//请求是否异步，默认为异步，这也是ajax重要特性
	    type:"POST",   //请求方式
	    success:function(r){
	        //请求成功时处理
	    	if(r.code == 0){
	    		$("#transaction").text(r.queryCount.transaction + "元")
	    		$("#total").text(r.queryCount.total + "笔")
	    		$("#profit").text(r.queryCount.profit + "笔")
	    		$("#loss").text(r.queryCount.loss + "笔")
	    		$("#profita").text(r.queryCount.profita + "元")
	    	}
	    }
	});
	$.get(baseURL + "sys/sysTotal/All", function(r){
		console.log(r)
	})	
    $("#jqGrid").jqGrid({
        url:  baseURL + 'sys/sysTotal/list',
        datatype: "json",
        colModel: [			
			{ label: '订单总数', name: 'total', width: 75 },
			{ label: '交易总额', name: 'transaction', width: 90 },
			{ label: '盈利订单总数', name: 'profit', width: 100 },
			{ label: '亏损订单总数', name: 'loss', index: "brokerid", width: 80},
			{ label: '总盈亏', name: 'profita', width: 75 },
        ],
        viewrecords: true,
		height: "500",
        rowNum: 10,
		rowList : [10,30,50],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: false,
        autoScroll: true,
        shrinkToFit: false,//此属性用来说明当初始化列宽度时候的计算类型，如果为ture，则按比例初始化列宽度。如果为false，则列宽度使用colModel指定的宽度
        autowidth: true, //如果为ture时，则当表格在首次被创建时会根据父元素比例重新调整表格宽度。如果父元素宽度改变，为了使表格宽度能够自动调整则需要实现函数：setGridWidth
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        },
        gridComplete:function(){
        	//隐藏grid底部滚动条
        	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        	$('a').click(function(){
        		var userDa=$('#jqGrid').jqGrid('getRowData','rowId')
        		console.log(userDa);
        	});
        	
        	var a=document.createElement('script');
        	a.src="/sys/sysTotal/All";
        	
        }
    });
});



var vm = new Vue({
	el:'#rrapp',
	data:{
		q:{
			isHookBalance: null,
			mname: null,
			utel: null
		},
		aa:0,
		showList: true,
		title: null,
		customer: {},
			total:{},
			count:{}
			
	},
	methods: {
		query: function () {
			vm.reload();
		},
		add: function(){
			vm.showList = false;
			vm.title = "新增";
			vm.customer = {};
		},
		update: function () {
			var id = getSelectedRow();
			if(id == null){
				return ;
			}
			console.log(1);
			$.get(baseURL + '/sys/sysCustomer/info/'+id,function(r){
				vm.showList = false;
				console.log(r);
                vm.title = "修改";
				vm.customer = r.customer;
				
			});
			 $.ajax({
		        type: "POST",
		        url: "/sys/sysCustomer/info/",
		        contentType: "application/json;charset=utf-8",
		        dataType: "json",
		        data:"id="+id,
		        success: function (r) {
		        	vm.showList = false;
	                vm.title = "修改";
					vm.customer = r.customer;
		        },
		    }); 
		},
		up:function(){
			console.log(total);
			
		},
		update: function () {
			var id = getSelectedRow();
			if(id == null){
				return ;
			}
			
			vm.showList = false;
            vm.title = "修改";
			
			vm.getUser(id);
		},
		saveOrUpdate: function () {
            if(vm.validator()){
                return ;
            }

			var url = vm.customer.id != null ? "sys/sysCustomer/update" : "sys/sysCustomer/save";
			console.log(baseURL + url);
			$.ajax({
				type: "POST",
			    url: baseURL + url,
                contentType: "application/json",
			    data: JSON.stringify(vm.customer),
			});
			alert('操作成功', function(){
				vm.reload();
			});
		    
		},
		getUser: function(id){
			$.get(baseURL + "sys/sysCustomer/info/"+id, function(r){
				vm.customer = r.customer;
			});
		},
		getTatol:function(){
			$.get(baseURL + "sys/sysTotal/All", function(r){
				
				console.log(r);
				vm.total = r;
			})
		},
		del: function () {
			var id = getSelectedRows();
			if(id == null){
				return ;
			}
			confirm('确定要删除选中的记录？', function(){
				$.ajax({
					type: "POST",
				    url: baseURL + "sys/sysCustomer/delete",
                    contentType: "application/json",
				    data: id,
				    success: function(r){
						if(r.code === 0){
							alert('操作成功', function(){
								vm.reload();
							});
						}else{
							alert(r.msg);
						}
					}
				});
			});
		},
		reload: function (event) {
			vm.showList = true;
			var page = $("#jqGrid").jqGrid('getGridParam','page');
			$("#jqGrid").jqGrid('setGridParam',{ 
                postData:{'isHookBalance': vm.q.isHookBalance,
                		  'mname': vm.q.mname,
                		  'utel': vm.q.utel
                	},
                page:page 
            }).trigger("reloadGrid");
		},
        validator: function () {
           if(isBlank(vm.customer.busername)){
                alert("客户名不能为空");
                return true;
            }

            if(isBlank(vm.customer.operationscenter)){
                alert("运营中心不能为空");
                return true;
            }

        }
		
	},

	mounted:function(){
		console.log("vue mounted")
		$.get(baseURL + "sys/sysTotal/All", function(r){
			
			vm.total=r.homesummary[0]		
			console.log(vm.total)
		})	
		$.get(baseURL + "sys/sysTotal/list", function(r){
			console.log(r.queryCount)
			vm.count=r.queryCount;	
		
		})	
		$.get(baseURL + "/sys/noticeSetting/findNotice", function(r){			 
			 console.log(r.list);	
			
		})	
	},
	updated:function(){
		console.log("vue updated")
	$.get(baseURL + "sys/sysTotal/All", function(r){
			
			vm.total=r.homesummary[0]		
			console.log(vm.total)
		})	
		$.get(baseURL + "sys/sysTotal/list", function(r){
			console.log(r.queryCount)
			vm.count=r.queryCount;	
		
		})	
		
	}
	
});*/